/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ControlEscolar.DAOs;

import com.ControlEscolar.DataBase.DbConnection;
import java.util.ArrayList;

/**
 *
 * @author Hudy
 */
public abstract class AbstractDAO<T> {
    protected DbConnection connection = DbConnection.initConnection();
    
    

    
    /**
     *
     *
     */
    public abstract void add(T object)throws DAOException;

    /**
     *
     *
     */
    public abstract int delete(String condition)throws DAOException;

    /**
     *
     *
     */
    public abstract int update(T object)throws DAOException;

    /**
     *
     *
     */
    public abstract ArrayList<T> query ()throws DAOException;

    /**
     *
     *
     */
    public boolean  queryIsEmpty(ArrayList<T> query){
        return query.size()==0;

    }

    public T getSpecificQuery(ArrayList<T> object){
        if(queryIsEmpty(object))
                return null;
         else
               return object.get(0);

    }
}
